import { globalStore } from "../../store/index";

Page({
  data: {
    loading: true,
  },

  async onShow() {
    this.setData({ loading: true });
    await globalStore.initAppData();
    const profile = globalStore.userProfile;
    if (!profile) {
      this.setData({ loading: false });
      wx.redirectTo({ url: "/pages/auth/login/index" });
      return;
    }
    wx.switchTab({ url: "/pages/user/home/index" });
  },
});
